import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { BusiProvider } from '../../providers/busi/busi';

/**
 * Generated class for the UserlistPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@IonicPage()
@Component({
  selector: 'page-userlist',
  templateUrl: 'userlist.html',
})
export class UserlistPage {
  selectedseg='0';
  userlist=[];
  constructor(public navCtrl: NavController, public navParams: NavParams,private busi: BusiProvider) {
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad UserlistPage');
  }
  ionViewDidEnter(){
   this.getUserList();
  }
  getUserList(){
    this.busi.getSysUserList(this.selectedseg).subscribe(
      data=>{
        this.userlist = data.userlist;
      },err=>{

      }
    );
  }
  goToUserDetail(user){
    this.busi.getUserDetail(user.userid).subscribe(data=>{
      this.navCtrl.push("UserdetailPage",{userdetail:data.userdetail})

    },err=>{

    })
  }

}
